﻿using SDFL.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Test_SDFL.Utilities
{
    
    
    /// <summary>
    ///This is a test class for StrHelperTest and is intended
    ///to contain all StrHelperTest Unit Tests
    ///</summary>
    [TestClass()]
    public class StrHelperTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for ToBinary
        ///</summary>
        [TestMethod()]
        public void ToBinaryTest()
        {
            long[] decimalNums = {25, 0, 1, 2}; // TODO: Initialize to an appropriate value
            string[] expected = {"11001", "0", "1", "10"}; // TODO: Initialize to an appropriate value
            string actual;
            for (int i = 0; i < decimalNums.Length; i++)
            {
                actual = StrHelper.ToBinary(decimalNums[i]);
                Assert.AreEqual(expected[i], actual);
            }
            
            
        }

        /// <summary>
        ///A test for MaxofDupCharacter
        ///</summary>
        [TestMethod()]
        public void MaxofDupCharacterTest()
        {
            string[] str = new string[] { "abbbcccddddeeeffffff", "adf1123ssffddddf", "aff", "a" }; // TODO: Initialize to an appropriate value
            int[] expected = new int[] { 6, 4, 2, 1 }; // TODO: Initialize to an appropriate value
            int actual;

            for (int i = 0; i < str.Length; i++)
            {
                actual = StrHelper.MaxofDupCharacter(str[i]);
                Assert.AreEqual(expected[i], actual);

            }
        }        
    }
}
